package net.ithe.controller;

import lombok.extern.slf4j.Slf4j;
import net.ithe.pojo.ClazzOption;
import net.ithe.pojo.JobOption;
import net.ithe.pojo.Result;
import net.ithe.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService  reportService;
    @GetMapping(value ="/empJobData")
    public Result getEmpJobData(){
        log.info("查询员工职位人数");
        JobOption jobOption =reportService.getEmpJobData();
        return Result.success(jobOption);
    }
    @GetMapping(value ="/studentCountData")
    public Result getClazzOption(){
        log.info("查询班级人数");
        ClazzOption clazzOption=reportService.getClazzOption();
        return Result.success(clazzOption);
    }

    /**
     * 查询员工性别人数
     * @return
     */
    @GetMapping(value ="/empGenderData")
    public Result getEmpGenderData(){
        log.info("员工性别人数");
        List<Map<String,Object>> genderList=reportService.getEmpGenderData();
        return Result.success(genderList);
    }

    /**
     * 学历统计
     * @return
     */
    @GetMapping("/studentDegreeData")
    public Result getDegreeOption() {
        log.info("学历统计");
        List<Map<String, Object>> degreeData = reportService.getDegreeData();
        return Result.success(degreeData);
    }
}
